//
//  ConfirmCreditViewController.m
//  EasyToo
//
//  Created by Jr Lan on 13-9-6.
//
//

#import "ConfirmCreditViewController.h"
#import <QuartzCore/QuartzCore.h>

@interface ConfirmCreditViewController ()

@end

@implementation ConfirmCreditViewController
{
    UIAlertView *_baseAlert;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    //初始化视图
    [self init_view];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


//初始化视图
- (void)init_view
{
    //定义title
    self.title = @"信用卡";
    //加载背影
    [self.view setBackgroundColor:BackgroundColor];

    UIImageView *infoimgview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"表格6行.png"]];
    infoimgview.frame = CGRectMake(20, 80, 280, 250);
    [self.view addSubview:infoimgview];
    
    NSMutableArray *textarray = [[NSMutableArray alloc]init];
    [textarray addObject:@"终端信息：一指通IOS客户端"];
    [textarray addObject:[NSString stringWithFormat:@"信用卡号：%@", self.cardno]];
    [textarray addObject:[NSString stringWithFormat:@"信用卡银行：%@", self.bankname]];
    [textarray addObject:[NSString stringWithFormat:@"持卡人姓名：%@", self.name]];
    [textarray addObject:[NSString stringWithFormat:@"还款金额：%@", self.cash]];
    if (self.paytype == 0) {
        [textarray addObject:@"支付方式：网银支付"];
    } else {
        [textarray addObject:@"支付方式：支付宝支付"];
    }
    
    
    int i;
    for (i = 0; i < [textarray count]; i ++) {
        UILabel *textlbl = [[[UILabel alloc]initWithFrame:CGRectMake(50, 135+30*i, 280, 30)]autorelease];
        textlbl.text = [textarray objectAtIndex:i];
        textlbl.font = [UIFont systemFontOfSize:13];
        textlbl.backgroundColor = [UIColor clearColor];
        textlbl.adjustsFontSizeToFitWidth = YES;
        [self.view addSubview:textlbl];
    }
    
    UIButton *nextStep =[UIButton buttonWithType:UIButtonTypeCustom];
    nextStep.frame = CGRectMake(40, 340, 230, 40);
    [nextStep setBackgroundImage:[UIImage imageNamed:@"xyb"] forState:UIControlStateNormal];
    [nextStep setTitle:@"确认支付" forState:UIControlStateNormal];
    nextStep.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    nextStep.layer.borderColor = [UIColor grayColor].CGColor;
    nextStep.layer.borderWidth = 1 ;
    nextStep.layer.cornerRadius = 10 ;
    [self.view addSubview:nextStep];
    [nextStep addTarget:self action:@selector(confirmMessge) forControlEvents:UIControlEventTouchUpInside];
}

- (void)confirmMessge
{
    _baseAlert = [[UIAlertView alloc]  initWithTitle:@"信用卡充值" message:@"信用卡充值功能暂未开放，敬请期待，谢谢"  delegate:self cancelButtonTitle:@"返回" otherButtonTitles: nil];
    [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(performDismiss:) userInfo:nil repeats:NO];
    [_baseAlert show];
}


- (void) performDismiss: (NSTimer *)timer {
    [_baseAlert dismissWithClickedButtonIndex:0 animated:NO];//important
    [_baseAlert release];
    _baseAlert = NULL;
}

@end
